module.exports = function ($scope, $resource, $modal, $modalInstance, travel, toaster){

    $scope.travelInfoList = function(pageNo){
        var para = {
            'pageNo': pageNo,
            'pageSize': $scope.itemsPerPage,
            'detail': '1',
            'company_code': travel.company_code,
        }
        $resource('/api/as/goc/outboundtravel/getTravelInfoList', {}, {}).save(para, function(res){
            if (res.errcode === 0) {
                $scope.travelInfoList = res.data.results;
                $scope.totalItems = res.data.totalRecord;
                $scope.currentPage = pageNo;
            } else {
                toaster.error({title: '', body: '查询游客信息失败'});
            }
        });
    }

    init();
    function init(){
        $scope.currentPage = 1;			//当前页码
        $scope.itemsPerPage = 10;		//每页显示几条
		$scope.dictTravel = {
			'a1': '未上报',
			'a2': '已上报',
			'a3': '已通过',
			'a4': '未通过',
		};
        $scope.travelInfoList(1);
    }

	//游客名单
	$scope.infolist = function(item){
		var modalInstance = $modal.open({
			template: require('../views/infolist.html'),
			controller: 'infolist',
			size: 'lg',
			resolve: {
				getDate : function(utilservice){
					return utilservice.getDate;
				},
				travel: function () {
					return item;
				},
				updateFlag: function () {
					return false;
				},
                checkFlag: function () {
                    return false;
                }
			}
		});
	}

    $scope.close = function () {
        $modalInstance.dismiss('cancel');
    }

};